package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.query.DailyCommendQueryObject;
import cn.wolfcode.trip.base.service.IDailyCommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("dailyCommends")
public class DailyCommendController {

    @Autowired
    private IDailyCommendService dailyCommendService;

    @GetMapping("/{id}")
    public Object get(@PathVariable Long id) {
        return dailyCommendService.get(id);
    }

    @GetMapping
    public Object getAll(@ModelAttribute("qo") DailyCommendQueryObject qo) {
        qo.setOrderBy("dc.type desc, dc.sequence");
        return dailyCommendService.query(qo);
    }


}
